package ui;

import java.awt.EventQueue;

import javax.swing.JInternalFrame;

import database.relation.Relation;
import database.relation.Table;

import javax.swing.JList;
import javax.swing.AbstractListModel;
import javax.swing.JScrollPane;
import java.awt.Font;
import java.awt.event.MouseMotionAdapter;
import java.awt.event.MouseEvent;

public class TableInnerFrame extends JInternalFrame {
	private final static int HEIGHT_LINE = 20;
	private final static int WIDTH_LINE = 190;
	public Relation rTable;
	public Table tTable;
	public MyListAtt myList;
	
	String[] values;
	
	/**
	 * Create the frame.
	 */
	public TableInnerFrame(Table table) {
		this.tTable = table;
		
		this.setTitle(this.tTable.getTableName());
		
		values = tTable.getListColumn();
		
		getContentPane().setLayout(null);
		
		int X = (int) (Math.random() * 1000);
		
		int Y = (int) (Math.random() * 500);
		
		this.setBounds(X, Y, WIDTH_LINE, HEIGHT_LINE * values.length + 33);
		
		myList = new MyListAtt(table.getListColumn(), table.getKey());
		
		getContentPane().add(myList);
		
		this.setVisible(true);
	}
}
